package com.athuahua.r2dbc.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.relational.core.mapping.Embedded;
import org.springframework.data.relational.core.mapping.Table;

import java.sql.Timestamp;
import java.time.Instant;
import java.time.LocalDateTime;
import java.util.Objects;

import static org.springframework.data.relational.core.mapping.Embedded.OnEmpty.USE_NULL;

/**
 * @Author: huahua
 * @Date: 2024/12/3 0003
 * @Time: 15:37
 * @Description:
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "t_book")
public class TBook {
    @Id
    private long id;
    private String title;
    private long authorId;
    private Instant publishTime;

    @Embedded(onEmpty = USE_NULL)
    @Transient
    private TAuthor author; //每本书唯一作者
}
